package com.cpfmat.common;

import java.io.FileOutputStream;
import java.io.InputStream;

public class FileUtil {
	public static void copy(InputStream oldfile, String newPath) {
		try {
			// int bytesum = 0;
			int byteread = 0;
			if (oldfile != null) {
				FileOutputStream fs = new FileOutputStream(newPath);
				byte[] buffer = new byte[1444];
				while ((byteread = oldfile.read(buffer)) != -1) {
					// bytesum += byteread;
					fs.write(buffer, 0, byteread);
				}
				fs.flush();
				oldfile.close();
				fs.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
